import React, { Component } from 'react'
import { fromJS } from 'immutable'
export default class App extends Component {
    state = {
        info: fromJS({
            name: {
                a: 1,
                b: 2
            },
            age: 18
        })
    }
    componentDidMount() {
        console.log(this.state.info.toJS())
    }
    render() {
        //一个新的深拷贝 插件
        //和map一模一样  get set('name','value')  将map对象转化成普通对象  .toJs()
        return (
            <div onClick={() => {
                this.setState({
                    info: this.state.info.setIn(['name', 'a'], 5)
                })
            }
            }>{this.state.info.get('name').get('a')}</div>
        )
    }
}
